import h5py


async def frames(ws, request, **kw):
  t = request.args.t
  with h5py.File(f'{t}/.h5', 'r') as f:
    while True:
      ds = await ws.recv()
      d = f[ds][:]
      await ws.send(d.tobytes())


import h5py


async def h5data(request, raw, **kw):
  t = request.args.t
  r = request.args.n
  with h5py.File(f'{t}/.h5', 'r') as f:
    return await raw(f[r][:].tobytes())
